package isquirrel;

import java.util.HashSet;
import java.util.Set;

public class DBpediaCollection {

	private int workers = 0; 
	private Set<String> urls = null;
	
	public DBpediaCollection(){
		urls = new HashSet<String>();
		
	}
	
	public synchronized void add(Set<String> workerurls){
		urls.addAll(workerurls);
	}
	
	public Set<String> urls(){	
		return urls;
	}

	public void incrementWorkers(){
		++workers;
	}
	
	public synchronized void decrementWorkers(){
		--workers;
		
	}
	
	public boolean workersDone(){
		return workers == 0;
		
	}
	
	public synchronized void resetCollection() {
		workers = 0; 
		urls.clear();
	}
}
